package edu.calvin.djs32.cs214.interpreters.calculator.primitives;

import edu.calvin.cs214.hobbes2008.HobbesTIR;
import edu.calvin.cs214.hobbes2008.IntegerTIR;
import edu.calvin.djs32.cs214.interpreters.calculator.Applicable;
import edu.calvin.djs32.cs214.interpreters.calculator.ICalculator;

public class PowPrimitive implements Applicable {

	public HobbesTIR apply(ICalculator calc, HobbesTIR... tir) {
		IntegerTIR arg0 = (IntegerTIR) tir[0];
		IntegerTIR arg1 = (IntegerTIR) tir[1];
		double finalDouble = Math.pow(arg0.getInt(), arg1.getInt());
		int finalInt = (int) finalDouble;
		return new IntegerTIR(finalInt);	
	}

}
